﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content.Pipeline;
using System.ComponentModel;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using NormalMappingEffectPipeline;
using Microsoft.Xna.Framework;

namespace ContentPipelineExtensions
{
    [ContentProcessor]
    [DesignTimeVisible(false)]
    public class ViperMaterialProcessor : MaterialProcessor
    {
        protected override ExternalReference<TextureContent> BuildTexture
            (string textureName, ExternalReference<TextureContent> texture,
            ContentProcessorContext context)
        {
            if (textureName == NormalMappingModelProcessor.NormalMapKey)
            {
                // put the normal map through the special NormalMapTextureProcessor,
                // which will convert it to a signed format.
                return context.BuildAsset<TextureContent, TextureContent>(texture,
                    typeof(NormalMapTextureProcessor).Name);
            }

            // Apply default processing to all other textures.
            return base.BuildTexture(textureName, texture, context);
        }
        protected override ExternalReference<CompiledEffectContent> BuildEffect(ExternalReference<EffectContent> effect, ContentProcessorContext context)
        {            
            var result = base.BuildEffect(effect, context);
            return result;
        }
        public override MaterialContent Process(MaterialContent input, ContentProcessorContext context)
        {            
            var result = base.Process(input, context);
            var asEffectContent = result as EffectMaterialContent;
            return result;
        }

        public Vector3 DiffuseColor { get; set; }
        public float Alpha { get; set; }
        public Vector3 EmissiveColor { get; set; }
        public Vector3 SpecularColor { get; set; }
        public float SpecularPower { get; set; }
        public Vector3 AmbientColor { get; set; }
    }
}
